<template>
  <div @click="goDetail(result.art_id)">
    <div class="item1" v-if="this.result.cover.type === 1">
      <div class="left">
        <div class="title">{{ result.title }}</div>
        <div class="sign-container">
          <span>{{ result.aut_name }}</span>
          <span class="comment">{{ result.comm_count }}评论</span>
          <span>{{ result.pubdate | dateYer }}年前</span>
        </div>
      </div>
      <div class="right">
        <img :src="result.cover.images[0]" alt="" />
      </div>
    </div>
    <div class="item2" v-if="this.result.cover.type === 0">
      <div class="title">{{ result.title }}</div>
      <div class="sign-container">
        <span>{{ result.aut_name }}</span>
        <span class="comment">{{ result.comm_count }}评论</span>
        <span>{{ result.pubdate | dateYer }}年前</span>
      </div>
    </div>
    <div class="item3" v-if="this.result.cover.type === 3">
      <div class="title">{{ result.title }}</div>
      <div class="images">
        <div
          class="img"
          v-for="(item, index) in result.cover.images"
          :key="index"
        >
          <img :src="item" alt="" />
        </div>
      </div>
      <div class="sign-container">
        <span>{{ result.aut_name }}</span>
        <span class="comment">{{ result.comm_count }}评论</span>
        <span>{{ result.pubdate | dateYer }}年前</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {
    result: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    goDetail(id) {
      this.$router.push(`/detail/${id}`)
    },
  },
}
</script>

<style scoped lang="less">
.item1 {
  display: flex;
  padding: 10px 16px;
  .left {
    width: 171.5px;

    .title {
      font-size: 14px;
      font-weight: normal;
      line-height: 23px;
    }
    .sign-container {
      font-size: 12px;
      line-height: 23px;

      color: #969799;
      .comment {
        margin: 0 5px;
      }
    }
  }
  .right {
    flex: 1;
    text-align: right;
    img {
      width: 116px;
      height: 73px;
    }
  }
}
.item2 {
  padding: 10px 16px;

  .title {
    font-size: 14px;
    font-weight: normal;
    line-height: 23px;
  }
  .sign-container {
    font-size: 12px;
    line-height: 23px;

    color: #969799;
    .comment {
      margin: 0 5px;
    }
  }
}
.item3 {
  padding: 10px 16px;

  .title {
    font-size: 14px;
    font-weight: normal;
    line-height: 23px;
  }
  .images {
    display: flex;
    justify-content: space-between;
    .img {
      width: 100px;
      height: 100px;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .sign-container {
    font-size: 12px;
    line-height: 23px;

    color: #969799;
    .comment {
      margin: 0 5px;
    }
  }
}
</style>
